<%-- 
    Document   : index
    Created on : 26/10/2009, 15:12:53
    Author     : mps
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="br.eti.mps.chiroptera.lib.Connection"%>
<%@page import="br.eti.mps.chiroptera.lib.ConnectionFactory"%>
<%@page import="br.eti.mps.chiroptera.constants.Constants"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.Hashtable"%>

<%

    String server = request.getParameter("server");
    String password = request.getParameter("password");
    String command = request.getParameter("command");

    String resultado = "";

    if (server != null && password != null && command != null) {
        Map<String, Object> configuration = new Hashtable<String, Object>();
        configuration.put(Constants.Chiroptera.ConfigurationKeys.HOST_ADDRESS, server);
        configuration.put(Constants.Chiroptera.ConfigurationKeys.HOST_PORT, 9101);
        configuration.put(Constants.Chiroptera.ConfigurationKeys.PASSWORD, password);
        Connection con = new Connection(configuration);
        resultado = con.executeCommand(command);
        con.disconnect();
    }
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <form name="f1" action="index.jsp">
            <p>Servidor: <input type="text" name="server"></p>
            <p>Senha: <input type="password" name="password"></p>
            <p>Commando: <input type="text" name="command"></p>
            <p><input type="submit" value="Command"></p>
        </form>
        <p><br></p>
        <pre>
<%=resultado%>
        </pre>
    </body>
</html>
